# 员工列表(员工编号 部门编号 姓名 工资)
dict_employees = {
    1001: {"did": 9002, "name": "师父", "money": 60000},
    1002: {"did": 9001, "name": "孙悟空", "money": 50000},
    1003: {"did": 9002, "name": "猪八戒", "money": 20000},
    1004: {"did": 9001, "name": "沙僧", "money": 30000},
    1005: {"did": 9001, "name": "小白龙", "money": 15000},
}

# 1. 定义函数,打印所有员工信息,
# 格式：xx的员工编号是xx,部门编号是xx,月薪xx元.
def item(key,value):
    print(f"{value['name']}的员工编号是{value['did']},部门编号是{key},月薪{value['money']}元")

def employees():
    for key,value in dict_employees.items():
        item(key,value)
employees()
# 2. 定义函数,打印所有月薪大于2w的员工信息,
# 格式：xx的员工编号是xx,部门编号是xx,月薪xx元.
def most():
    for key, value in dict_employees.items():
        if value["money"] > 20000:
            item(key, value)


most()


# 部门列表
list_departments = [
    {"did": 9001, "title": "教学部"},
    {"did": 9002, "title": "销售部"},
    {"did": 9003, "title": "品保部"},
]
# 3. 定义函数,在部门列表中查找编号最小的部门
def min_number():
    min_value = list_departments[0]
    for i in range(len(list_departments)-1):
        if min_value["did"] > list_departments[i]["did"]:
            min_value = list_departments[i]
    return min_value

min_numbers = min_number()
print(min_numbers)

# 4.定义函数, 根据部门编号对部门列表降序排列
def big_value_number():
    for r in range(len(list_departments)-1):
        for c in range(r+1,len(list_departments)):
            if list_departments[r]["did"]<list_departments[c]["did"]:
                list_departments[r],list_departments[c]=list_departments[c],list_departments[r]
big_value_number()
print(list_departments)